package com.xinqi.common.core.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.xinqi.common.base.enums.BaseEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 轮播图类型
 *
 * @Author：yyzhen
 * @Package：com.xinqi.common.core.enums
 * @Project：xingqiclass-cloud-plus
 * @name：RotationImageTypeEnum
 * @Date：2023/4/23 11:55
 * @Filename：RotationImageTypeEnum
 */
public enum RotationImageTypeEnum implements BaseEnum {

    /**
     * APP端
     */
    APP("APP", "APP端"),

    /**
     * PC端
     */
    PC("PC", "PC端");

    @Getter(onMethod_ = {@JsonValue})
    private final String code;

    @Getter
    private final String describe;

    RotationImageTypeEnum(String code, String describe) {
        this.code = code;
        this.describe = describe;
    }

    @JsonCreator
    public static RotationImageTypeEnum of(String code) {
        return BaseEnum.of(RotationImageTypeEnum.class, code);
    }

    public static List<Map<String, String>> getSelectList() {
        List<Map<String, String>> list = new ArrayList<>();
        for (RotationImageTypeEnum typeEnum : RotationImageTypeEnum.values()) {
            Map<String, String> map = new HashMap<>();
            map.put("code", typeEnum.getCode());
            map.put("describe", typeEnum.getDescribe());
            list.add(map);
        }
        return list;
    }
}
